#include "PhanSo.h"

int main()
{
	PhanSo phanso1, phanso2, phanso3;
	int ketthuc;
	cout << "-----------------Menu-----------------\n";
	cout << "1 - Cong hai phan so\n";
	cout << "2 - tru hai phan so\n";
	cout << "3 - nhan hai phan so\n";
	cout << "4 - chia hai phan so\n";
	cout << "5 - += them mot phan so\n";
	cout << "6 - -= them mot phan so\n";
	cout << "7 - *= them mot phan so\n";
	cout << "8 - /= them mot phan so\n";
	cout << "9 - so sanh hai phan so\n";
	cout << "0 - ket thuc chuong trinh\n";
	do{
		cout << "Nhap cach thuc tinh : ";
		cin >> ketthuc;
		if (ketthuc != 0)
		{
			cout << "Nhap phan so thu nhat:\n";
			phanso1.Nhap();
			cout << "\nNhap phan so thu hai:\n";
			phanso2.Nhap();
			phanso3 = phanso1;
		}
		switch (ketthuc)
		{
		case 1:
			phanso3 = phanso1 + phanso2;
			cout << "Tong hai phan so: ";
			break;
		case 2:
			phanso3 = phanso1 - phanso2;
			cout << "Hieu hai phan so: ";
			break;
		case 3:
			phanso3 = phanso1 * phanso2;
			cout << "Tich hai phan so: ";
			break;
		case 4:
			phanso3 = phanso1 / phanso2;
			cout << "Thuong hai phan so: ";
			break;
		case 5:
			phanso3 += phanso2;
			cout << "Tong phan so(+=) : ";
			break;
		case 6:
			phanso3 -= phanso2;
			cout << "Hieu phan so (-=): ";
			break;
		case 7:
			phanso3 *= phanso2;
			cout << "Tich phan so (*=): ";
			break;
		case 8:
			phanso3 /= phanso2;
			cout << "Thuong phan so (/=): ";
			break;
		case 9:
			if (phanso1 > phanso2)
			{
				phanso1.Xuat();
				cout << " lon hon ";
				phanso2.Xuat();
				cout << endl;
			}
			if (phanso1 < phanso2)
			{
				phanso1.Xuat();
				cout << " be hon ";
				phanso2.Xuat();
				cout << endl;
			}
			if (phanso1 == phanso2)
			{
				phanso1.Xuat();
				cout << " bang ";
				phanso2.Xuat();
				cout << endl;
			}
			break;
		default:
			cout << "Cong viec khong co trong danh sach!";
		}
		if (ketthuc != 0 && ketthuc != 9)
		{
			phanso3.Xuat();
			cout << endl;
		}
	} while (ketthuc != 0);
	
	return 0;
}